# coding:utf-8
import os
import PIL
import cv2
import skimage.util as su
import numpy as np
from scipy import misc
from io import BytesIO
import tempfile
ROWS=182
COLS=482
# img = misc.imread(r'F:\bigphoto\Fatp\32_无线_蜂窝3.jpg',mode="1")
# img = cv2.imread(r'F:\bigphoto\error\1547728724193.jpg',0)
# img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
# img = cv2.resize(img,(COLS,ROWS))

# noise = su.random_noise(img,mode='speckle',seed=2,clip=True,mean=0.1)
# img = img / 256
# print(img,type(img))
# img = misc.imresize(img, (ROWS, COLS), interp='bilinear')
# print(img.shape)
# cv2.imshow('s',img)
# cv2.imwrite('wifi32.jpg',img)
# img = np.expand_dims(img,axis=2)
# print(noise,type(noise))
# path = tempfile.mkdtemp(prefix='ii',dir=r'F:\bigphoto\Fatp')
# print(path)
# paths = os.path.join(path,'sf.jpg')
# cv2.imwrite(paths,img)
# misc.imsave('sf.jpg',noise)
# print(img.shape)
# print(img)
# with open(r'F:\bigphoto\Fatp\wifi_cell_128.jpg','rb') as f:
#     print(f.read())
#     imgpath=BytesIO(f.read())
# img = misc.imread(imgpath)
#

# # cv2.imshow('n',noise)
# cv2.waitKey(0)

# tflite_convert --keras_model_file=/hadoop/station_FATP_FB/model_bak/FATP_0121_t.h5 --output_file=/hadoop/station_FATP_FB/model_bak/tflite_bak/fatp_classifi.tflite --output_format=tflite